-
Notifications
You must be signed in to change notification settings - Fork 415
Vtr task and test script python rewrite #1509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vtr task and test script python rewrite #1509
Conversation
It doesn't look like the kokoro CI scripts were cut over to use the new python root script, see here: https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/.github/kokoro/steps/vtr-test.sh#L48 |
@litghost I have fixed that instance and others of the older perl scripts. |
Kokoro tests will fail right now, as pointed out by @litghost here. This will be fixed once the requirements pull request is merged |
And one Qor test will fail on vtr_reg_Strong until this pull request is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to abstract out anything that might be useful to change, such as paths, and document file formats that are parsed or generated.
Parsing could be made more flexible by not expecting fixed parameter names.
|
||
#ABC Run-time Metrics | ||
abc_synth_time;abc0.out;elapse: .* seconds, total: (.*) seconds | ||
abc_cec_time;abc.cec.out;elapse: .* seconds, total: (.*) seconds | ||
abc_sec_time;abc.sec.out;elapse: .* seconds, total: (.*) seconds | ||
abc_sec_time;abc.lec.out;elapse: .* seconds, total: (.*) seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this change do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes which file it looks for this parameter. I believe by the request of Vaughn the file name was changed from abc.sec.out to abc.lec.out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I didn't ask for this (don't recall anything about it). Is this the logical equivalence check runtime (and hence maybe lec is a better name than sec, which would seem to imply sequential equivalence check)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, it was Kevin, #1429 (comment)
vtr_flow/scripts/parse_vtr_task.pl
Outdated
my $task_name = shift; | ||
(my $task_path = $task_name) =~ s/\s+$//; | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
run_reg_test.py
Outdated
"odin_reg_micro", | ||
"vtr_reg_valgrind_small", | ||
], | ||
help="Regression tests to be run", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these tests be in a config file, or inferred from the directory structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
row += [(values[2] % float(info[values[0]])) + values[1]] | ||
table.add_row(row) | ||
print(table) | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has a lot of numbers without any explanation. Please name them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
run_reg_test.py
Outdated
vtr_task_list_files = [] | ||
if reg_test.startswith("vtr"): | ||
task_list_filepath = str( | ||
Path(find_vtr_root()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this path be an argument or environment variable? At the least, please put arbitrary constants (such as a location which could change) at the top of the file with a description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An environment variable is used in the function find_vtr_root() I updated this to use it more efficiently. Let me know if there is anything else I should do with this.
with redirect_stdout(parse_file): | ||
parse_vtr_flow(job.parse_command()) | ||
if job.second_parse_command(): | ||
parse_filepath = str(PurePath(work_dir) / "parse_results_2.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move arbitrary file names to top of file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
# We do not worry about non-pass_requriements elements being different or missing | ||
pass_req_filepath = str( | ||
PurePath(find_vtr_root()) | ||
/ "vtr_flow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hard-coded paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
) | ||
|
||
# Keys that are repeated to create lists | ||
repeated_keys = set(["circuit_list_add", "arch_list_add", "script_params_list_add"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern is that lists are built from *_list_add parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
vtr_flow/scripts/run_vtr_task.py
Outdated
Path(work_dir).mkdir(parents=True) | ||
run_script_file = Path(work_dir) / "vtr_flow.sh" | ||
with open(run_script_file, "w+") as out_file: | ||
print("#!/usr/bin/env bash", file=out_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of embedding this, could this be a template that is loaded?
At the very least, could this be joined into one string and one call to format
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a template in the newest commit.
vtr_flow/scripts/run_vtr_task.py
Outdated
""" format the number of seconds given as a human readable value """ | ||
if seconds < 60: | ||
return "%.0f seconds" % seconds | ||
if seconds < 3600: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not "60 * 60" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
Travis CI failed on the Odin-II Micro tests, with what looks like test script issue:
@shadtorrie can you take a look? |
This has been fixed. |
Not sure why kokoro hasn't started yet; trying to force a restart. |
Looks like there is an import failure that's killing the VtR Strong Tests:
@shadtorrie can you take a look? |
@vaughnbetz Yes this is fixed in my add python requirements pull request, once that is merged then this will not occur. |
run_reg_test.py
Outdated
print("=" * 121) | ||
print("\t" * 6, end="") | ||
print("{} QoR Results".format(reg_test)) | ||
print("=" * 121) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the width be parameterized? Or at least add a function to print a header (lines 229-232.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
run_reg_test.py
Outdated
"""Call 'run_vtr_task' with all the required arguments in the command""" | ||
print("Running {}".format(args.reg_test[0])) | ||
print( | ||
"-------------------------------------------------------------------------------" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's another divider with a different width. It would be nice to either have these be the same width, or add a function to print some text with an underline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed.
This is waiting on #1510 |
#1510 is now merged. Just waiting on CI then this should be good to go. |
8a254de
to
9313160
Compare
vtr strong sanitized is passing on other recent PRs, so I don't think the master is broken. The last ruptime indicates it takes a little more than 1h 21 m (vs. 2 hour timeout). See https://source.cloud.google.com/results/invocations/07b4a0f7-69ef-43ca-aef1-38266d1fc726/targets/foss-fpga-tools%2Fverilog-to-routing%2Fupstream%2Fpresubmit%2Fstrong_sanitized/log from PR #1541 You could trigger a CI on the master if you want to check by making a trivial change PR. May be more elegant ways than that, but that's the easiest. I suggest running vtr strong sanitized locally with the new infrastructure and seeing if it passes, and if so, how long it takes. If something is hanging hopefully it's more clear from what hangs what the problem is. Note that there are some expected vpr failures (checking bad input arguments, routing failures etc.) which is why the output in the link above has some detailed output and OK* values. (OK* means we expected a CAD flow failure, and we got one, so OK). |
Looks to be fixed now. I'll see how the nightly goes, but the sanitized is working now. The issue was related to how the
When I ran locally and watched it with I changed the code to
and now it is working as expected. It's hard to find much information about this online, and from what I've read these two approaches should be doing the same thing, but in reality they weren't. Not sure if this is a Python bug in |
Nice debugging; that's a subtle one. |
run_reg_test, run_vtr_task, parse_vtr_task and parse_vtr_flow have all been converted to python
Description
Using the old python rewrite branch as a starting place, I converted run_reg_test.pl, run_vtr_task.pl, parse_vtr_task.pl and parse_vtr_flow.pl to run_reg_test.py, run_vtr_task.py, parse_vtr_task.py and parse_vtr_flow.py.
These should be direct replacements of the perl counterpart.
Be aware that I placed the parse_vtr_task and parse_vtr_flow within the python library created by the run_vtr_flow pull request.
Related Issue
The issue this partially fixes
Motivation and Context
We want to be able to run the vtr test suite without requiring perl to be installed.
How Has This Been Tested?
All regression tests pass by using run_reg_test.
I tested the scripts individually and together, ensuring all parameters are enabled and work.
Types of changes
Checklist: